/*
 * @Author: wang cong wangc9832@163.com
 * @Date: 2023-12-22 09:43:27
 * @LastEditors: wang cong wangc9832@163.com
 * @LastEditTime: 2023-12-22 16:17:19
 * @FilePath: /ams_kt_front/src/api/asset/assetCost.ts
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
const api = '/amsAssetCostChange';
// 新增
export const add = (params?: any) =>
  defHttp.post({ url: api + '/add', params });
  // 编辑
  export const edit = (params?: any) =>
  defHttp.post({ url: api + '/edit', params });
  // 删除
  export const del = (ids: string[]) =>
  defHttp.post({ url: api + '/delete', params: ids });
// 不分页查询
export const page = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/page', params });
  
  // 导出
  export const exp = (params?: any) => {
    return new Promise<void>((resolve, reject) => {
      defHttp
        .get(
          { responseType: 'blob', url: api + '/export', params },
          { isReturnNativeResponse: true }
        )
        .then((res) => {
          downloadBlob(res);
          resolve();
        })
        .catch(() => {
          reject();
        });
    });
  };
  // 详情
  export const detail = (params: string) =>
  defHttp.get<BasicFetchResult<any>>({ url: `${api}/detail/` ,params});